<!DOCTYPE html>
<html>
<head lang="en">
	<meta charset="UTF-8">
	<title></title>
</head>
<body>
	<!-- include the performance framework first, so it can initialize and inject its UI -->
	<script src="perfFramework.js"></script>
	
	<!-- this test will use PreloadJS to load required assets -->
	<script src="../../examples/assets/preloadjs-NEXT.min.js"></script>
	<script>
		// runTest is a special method called by the performance framework
		// it passes the version array (ex. [0,7,1]) and a hash of all the query string values
		function runTest(version, qs) {
			var ns = checkVersion("0.5") ? createjs : window;
			
			var canvas = document.getElementById("testCanvas");
			var w=canvas.width, h=canvas.height;
			var stage = new ns.Stage("testCanvas");
			stage.tickOnUpdate = false;
			
			var arr = [], l=100000;
			var g = new ns.Graphics().beginFill("red").drawRect(0,0,2,2);
			for (var i=0; i<l; i++) {
				var sprite = new ns.Shape(g);
				sprite.x = Math.random()*w|0;
				sprite.y = Math.random()*h|0;
				arr.push(sprite);
			}
			
			time("total");
			time("add");
			for (var i=0; i<l; i++) {
				stage.addChild(arr[i]);
			}
			endTime("add", true);
			
			// stage.update() // if visual proof is needed.
			
			time("remove");
			for (var i=0; i<l; i++) {
				stage.removeChildAt(0);
			}
			endTime("remove", true);
			
			endTime("total", true);
			endTest();
		}
	</script>
	
	<p>Tests performance of adding and removing 100k instances from a stage.</p>
	<canvas id="testCanvas" width="900" height="450"></canvas>
</body>
</html>